import { Column, Entity, Index, UpdateDateColumn } from 'typeorm';
import { IBaseEntity } from '../../00_base/IBaseEntity';

@Index('PK__u9_bom__3213E83F7567BC9E', ['id'], { unique: true })
@Entity('u9_bom', { schema: 'dbo' })
export class U9Bom extends IBaseEntity {
  @Column('varchar', { name: 'itemMaster', nullable: true, length: 255 })
  itemMaster: string | null;

  @Column('money', { name: 'price', nullable: true })
  price: number | null;

  @Column('numeric', {
    name: 'RunLaborHours',
    nullable: true,
    precision: 18,
    scale: 0,
  })
  runLaborHours: number | null;

  @Column('money', { name: 'salary', nullable: true })
  salary: number | null;

  @Column('money', { name: 'TotalMechanicalCost', nullable: true })
  TotalMechanicalCost: number | null;

  @Column('money', { name: 'PurchasedMaterialCost', nullable: true })
  PurchasedMaterialCost: number | null;

  @Column('money', { name: 'PurchasedMaterialPremium', nullable: true })
  PurchasedMaterialPremium: number | null;

  @Column('money', { name: 'ManufacturingCost', nullable: true })
  ManufacturingCost: number | null;

  @Column('money', { name: 'ElectricityCost', nullable: true })
  electricityCost: number | null;

  @Column('money', { name: 'Interest', nullable: true })
  interest: number | null;

  @Column('money', { name: 'totalSalary', nullable: true })
  totalSalary: number | 0; // 员工总工资

  @Column('money', { name: 'PurchasedMaterialPremiumP', nullable: true })
  PurchasedMaterialPremiumP: number | 0; // 采购保险费率

  @Column('money', { name: 'ManufacturingCostP', nullable: true })
  ManufacturingCostP: number | 0; // 制造费率
  @Column('money', { name: 'InterestP', nullable: true })
  InterestP: number | 0; // 财务利率
  @Column('money', { name: 'totalPrice', nullable: true })
  totalPrice: number | 0; // 合计

  @UpdateDateColumn({
    name: 'start_date',
    nullable: true,
    type: 'datetime2',
  })
  startDate: Date | null;
}
